package com.zs.ssh.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zs.ssh.entity.User;
import com.zs.ssh.service.IUserService;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * 用户操作表
 *
 * @author: 赵圣
 * @date: 2018年9月27日下午3:48:53
 * @Version 1.0
 */
@Controller
@Scope("prototype")
@Namespace("/user")
public class UserAction {

    HttpServletResponse response = ServletActionContext.getResponse();
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpSession session = request.getSession();

    @Autowired
    private IUserService userService;

    @Action("addUser")
    public void addUser() {
        int sal = Integer.parseInt(request.getParameter("shopId"));
        User user = new User();
        user.setName("江小白");
        user.setPassword("13528710874");
        user.setSal(sal);
        userService.addUser(user);
        return;
    }

}
